<?php
if(!session_id()) { session_start(); }
include_once('../classes/portfolio.class.php');
include_once('../classes/binomial.class.php');
$portfolio = new Portfolio();
$calculator = new Binomial();
$result = $calculator->Calculate($_POST['call_put'], $_POST["stock_price"], $_POST["option_price"], $_POST['expiry'], $_POST["interest_rate"], $_POST['volatility']);
$success = $portfolio->add($_POST['call_put'], $_POST["stock_name"], $_POST["stock_price"], $_POST["option_price"], $_POST['expiry'], $_POST["interest_rate"], $_POST['volatility'], $result);
if($success == 800) {
	echo $result;
} else {
	echo false;
}
?>